package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.U_cate;

//DAO
public interface U_cateMapperBase {

	// 根据id查看
	@Select("SELECT * FROM u_cate  WHERE id = #{id}")
	public U_cate findU_cateById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM U_cate order by sort asc")
	public List<U_cate> findU_cates();

	// 添加
	@Insert("INSERT INTO u_cate (cate_name, cate_type, keywords, cate_desc, sort, parent_id, creater_id, modified_by, modified_time, add_time, is_valid, is_show_date, allow_comment,ext1,ext2,ext3,ext4,ext5) VALUES (#{cate_name}, #{cate_type}, #{keywords}, #{cate_desc}, #{sort}, #{parent_id}, #{creater_id}, #{modified_by}, #{modified_time}, #{add_time}, #{is_valid}, #{is_show_date}, #{allow_comment},#{ext1},#{ext2},#{ext3},#{ext4},#{ext5})")
	@Options(useGeneratedKeys = true, keyProperty = "id")
	public int insertU_cate(U_cate u_cate);

	// 修改
	@Update("UPDATE u_cate SET cate_name = #{cate_name}, cate_type = #{cate_type}, keywords = #{keywords}, cate_desc = #{cate_desc}, sort = #{sort}, parent_id = #{parent_id}, creater_id = #{creater_id}, modified_by = #{modified_by}, modified_time = #{modified_time}, add_time = #{add_time}, is_valid = #{is_valid}, is_show_date = #{is_show_date}, allow_comment = #{allow_comment} WHERE id = #{id}")
	public int updateU_cate(U_cate u_cate);

	// 删除
	@Delete("DELETE FROM u_cate  WHERE id = #{id}")
	public int deleteU_cate(Integer id);

	// Foreign keys revelant

	// region Indexs revelant

	// 获取根据parent_id
	@Select("SELECT * FROM u_cate  WHERE parent_id = #{parent_id}")
	public List<U_cate> findU_catesByParent_id(String parent_id);

}
